﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OnlineMealOrdering.Domain.Base;

namespace OnlineMealOrdering.Domain
{
    public class ShopItemEntity : AuditableEntity
    {
        public virtual FoodEntity Food { get; set; }

        public int Amount { get; set; }

        public decimal Price { get; set; }

        public static ShopItemEntity CreateItem(int foodId, int Amount, decimal price)
        {
            var entity = new ShopItemEntity();
            entity.Amount = Amount;
            entity.Price = price;

            return entity;
        }

        public void Change(int amount,decimal? price=null)
        {
            if (price != null)
                this.Price = price.Value;
            this.Amount = amount;
        }
    }
}
